package Shape;

public class ShapeFactory {
    public static Shape getShape(String type) {
        Shape shape = null;
        if (type.equalsIgnoreCase("C")) {
            shape = new Circle();
            System.out.println("创建圆形");
        } else if (type.equalsIgnoreCase("R")) {
            shape = new Rectangle();
            System.out.println("创建矩形");
        } else if (type.equalsIgnoreCase("T")) {
            shape = new Triangle();
            System.out.println("创建三角形");
        } else {
            System.out.println("抛出异常");
        }
        return shape;
    }
}
